package com.alks.function.mapper;

import com.alks.common.data.dto.SysUserTokenDTO;
import com.alks.entity.data.entity.*;
import com.alks.entity.data.entity.excel.BusMtlDataSheet;
import com.alks.entity.data.entity.imes.*;
import com.alks.function.data.dto.SdBomPartNew2Rep;
import com.alks.function.data.dto.chengKong.assort.YfBomPartNew2Dto;
import com.alks.function.data.dto.procurement.SdBrandDto;
import com.alks.function.data.request.quotation.PcStyleCraftRequest;
import com.alks.function.data.request.quotation.bom.BomDataCopyReq;
import com.alks.function.data.request.stock.SdMtlNewReq;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@Mapper
public interface SdStyleMapper extends BaseMapper<SdStyle> {

    List<PcStyleCraftRep> getUnProcessStyle(PcStyleCraftRequest rep);

    List<PcStyleCraftRep> getSelectStyle(PcStyleCraftRequest rep);

    void insertProcess(@Param("rep") PcStyleCraftRequest rep, @Param("username") SysUserTokenDTO dto);

    List<StyleProductionProcess> getStyleProductionList(PcStyleCraftRequest request);

    void copyStyleProcess(@Param("collect") List<StyleProductionProcess> collect, @Param("request2") PcStyleCraftRequest request2);

    void updateProcess(@Param("collect") List<StyleProductionProcess> collect, @Param("req") PcStyleCraftRequest req);

    void updateCut(@Param("collect") List<StyleProductionProcess> collect, @Param("req") PcStyleCraftRequest req);

    List<StyleProductionProcess> getSdBomPartNew2(PcStyleCraftRequest rep);

    void insertProcessNew(@Param("collect") List<StyleProductionProcess> collect, @Param("rep") PcStyleCraftRequest rep);

    void insertIntoProcess(@Param("req") StyleProductionProcess req, @Param("style") String style, @Param("styleColor") String styleColor);

    void deleteIntoProcess(@Param("req") StyleProductionProcess req, @Param("style") String style, @Param("styleColor") String styleColor);

    void updateStyleProcess(@Param("req") StyleProductionProcess req, @Param("style") String style, @Param("styleColor") String styleColor);

    List<PcDiffPart> renewalSiteDifferenceList(@Param("loginName") SysUserTokenDTO loginName, @Param("style") String style, @Param("color") String color);

    void deleteSize(@Param("req") PcDiffPart req, @Param("name") String name);

    List<SdStyleProcessNewLog> processUpdateRecord(@Param("style") String style, @Param("companyId") String companyId);

    List<String> getProcess();

    List<PcStyleCraftRep> getProcessHead(PcStyleCraftRequest rep);

    void updateCheck(@Param("req") PcStyleCraftRequest req, @Param("s") String s);

    List<PcStyleCraftRep> getReturnSelect(PcStyleCraftRequest rep);

    void insertLog(@Param("collect") List<StyleProductionProcess> collect, @Param("rep") PcStyleCraftRequest rep);

    List<SdBomFitSubNew2> getSdBomFitSubNew2(YfBomPartNew2Dto req);

    void addTypeChildren(@Param("subNew2") YfBomPartNew2Dto subNew2, @Param("subs") List<SdBomFitSubNew2> subs);

    void deleteSdBomFitSub(YfBomPartNew2Dto subNew2);

    String getMtlNoByName(SdBomFitSubNew2 new2);

    Integer getMaxByTypeNo(String typeNo);


    void insertIntoBomPart(YfBomPartNew2Dto req);

    void updateFitSplitConfirmation(SdBomFitSubNew2 req);

    Integer getFromSdMtlNew(String typeNo);

    void insertSdMtlNew(@Param("new2") SdBomFitSubNew2 new2, @Param("name") String name);

    String getMtlNo1(SdBomFitSubNew2 new2);

    void insertSdBomMtl(@Param("new2") SdBomFitSubNew2 new2, @Param("name") String name);

    void updateSdBomPartNew2(@Param("req") SdBomFitSubNewReq req, @Param("subNew2MtlNo") String subNew2MtlNo);

    String getFromSdMtlSubNew(SdBomFitSubNew2 new2);

    void insertInToSdMtlSubNew(@Param("req") SdBomFitSubNewReq req, @Param("new2") SdBomFitSubNew2 new2, @Param("name") String name);

    String getFromSdFitSubNo(SdBomFitSubNew2 new2);

    void insertIntoFitSub(@Param("req") SdBomFitSubNewReq req, @Param("new2") SdBomFitSubNew2 new2, @Param("name") String name);

    void insertBatchNew2(YfBomPartNew2Dto req);

    void updatePartSeq(YfBomPartNew2Dto req);

    void setNullMaterial(YfBomPartNew2Dto req);

    List<SdMtlTypeKey> classificationKeyList(SdMtlTypeKey req);

    void insertIntoKey(SdMtlTypeKey req);

    void bomDataReplication(BomDataCopyReq req);

    List<SdBomFitSub> getSdMtlSubNew(String mtlNo);

    List<SdMtlNew> getSdBomMtl(SdMtlNewReq req);

    @Select("SELECT COLOR_CODE FROM SD_COLOR_DETAIL WHERE COLOR_NAME = #{subMtlColor}")
    String getColorCode(SdBomFitSub sdBomFitSub);

    List<BusMtlDataSheet> sdBomMtlList(SdMtlNewReq req);

    String getBySdBomMtl( YfBomPartNew2Dto dto);

    void updateSdBomPartNew2List(List<YfBomPartNew2Dto> req);

    void copyCurrTo(SdBomPartNew2Rep req);

    @Select("SELECT MAX(COLOR_CODE) FROM SD_COLOR_DETAIL")
    Integer getMaxColor();

    List<String> getMtlColor(String colorName);

    void copyBomFit(@Param("req") SdBomPartNew2Rep req, @Param("seq") String seq);

    void deleteBomFit(@Param("req") SdBomPartNew2Rep req, @Param("seq") String seq);

    @Select("SELECT COLOR_NAME colorName,COLOR_CODE colorCode FROM SD_COLOR_DETAIL WHERE COLOR_NAME like concat('%',#{colorName},'%')")
    List<Map<String, Object>> getColorWithCode(String color);

    List<SdBomFitSub> getSdMtlSubFit(String mtlNo);


    List<ParamSettingResp> getParamSet(@Param("type") String type, @Param("name") String name);

    void insertIntoBaseCode(@Param("req") ParamSettingResp req, @Param("username") String username);

    void deleteBaseCode(ParamSettingResp req);

    List<TaskFillingResp> getTaskFiling(@Param("custNo") String custNo, @Param("styleNo") String styleNo, @Param("taskState") String taskState);

    void optionTask(@Param("req") List<TaskFillingResp> req, @Param("choose") String choose);

    @Select("select size_no from YF_STYLE_SIZE where style_no = #{styleNo}  order by cast(size_no as decimal(10,2))")
    List<String> getSizes(@Param("styleNo") String styleNo);
    @Select("select cut_size from YF_STYLE_SIZE where style_no = #{styleNo} order by cast(cut_size as decimal(10,2))")
    List<String> getCuts(@Param("styleNo") String styleNo);
    @Select("select last_size from YF_STYLE_SIZE where style_no = #{styleNo}  order by cast(last_size as decimal(10,2))  ")
    List<String> getLasts(@Param("styleNo") String styleNo);
    @Select("select sole_size from YF_STYLE_SIZE where style_no = #{styleNo} order by cast(sole_size as decimal(10,2))")
    List<String> getSoles(@Param("styleNo") String styleNo);

    List<TrailTaskHead> getTaskFilingDetail(@Param("styleNo") String styleNo, @Param("styleColor") String styleColor);

    List<Map<String, BigDecimal>> getTaskSize(String taskNo);

    List<StyleSize> selectStyleSizeByStyleYF(@Param("styleNo") String styleNo);

    TrailTaskSize querytTrailTaskSize(TrailTaskSize trailTaskSize);

    List<JiZhuanJinDuTree> queryJiZhuanJinDuTree(JiZhuanJinDuSearchObj searchObj);

    List<JiZhuanJinDu> queryJiZhuanJinDu(JiZhuanJinDuSearchObj searchObj);

    List<QcBaseParam> selectByExample(QcBaseParam param);

    String getLastSerialNum(@Param("s") String s);

    void insertIntoTrail(TrailTaskHead trailTaskHead);

    void updateStyleColorTaskStateYF(TaskFillingResp req);

    Integer getTaskSizeQty(TaskFilingDetailResp req);

    void updateTaskTrailSize(TaskFilingDetailResp req);

    void insertIntoTrailSize(TaskFilingDetailResp req);

    void updateTaskHeadSize(TaskFilingDetailResp req);

    List<JiZhuanJinDuTree> queryTaskProblemSolveTree(JiZhuanJinDuSearchObj searchObj);

    List<TaskProblemSolve> queryTaskProblemSolve(JiZhuanJinDuSearchObj searchObj);

    void insertIntoSdStylePro(PcDiffPart req);

    Integer getCount(@Param("req") StyleProductionProcess req, @Param("style") String style, @Param("styleColor") String styleColor);

    void insertIntoPcDiffPart(@Param("req") StyleProductionProcess req, @Param("style") String style, @Param("styleColor") String styleColor, @Param("user") SysUserTokenDTO user);

    void insertIntoLogs(@Param("req") StyleProductionProcess req, @Param("option") String option, @Param("dto") SysUserTokenDTO dto);

    BigDecimal getMaxSeq(PcDiffPart req);

    /*品牌*/
    List<SdBrandDto> getStyleList(String companyId);

    Integer getCheckNum(@Param("style") String style, @Param("styleColor") String styleColor);

    List<TrailTaskProcess> selectByExample1(TrailTaskProcess trailTaskProcess);

    TrailTaskProcess queryByQrCode(String qrCode);

    int queryMaxSeqNo(TrailTaskProcess trailTaskProcess);

    List<SysPost> selectUserPostsByUserId(Integer name);

    int queryAlreadyFinishNum(TrailTaskProcess trailTaskProcess);

    void updateFinishFlag(TrailTaskProcess trailTaskProcess);

    void insertTrialTask(TrailTaskProcess trailTaskProcess);

    void deleteDataByRowId(TrailTaskProcess trailTaskProcess);


    int insertTrailProcess(@Param("req") TaskFilingDetailResp req, @Param("sysUserTokenDTO") SysUserTokenDTO sysUserTokenDTO, @Param("newTaskNo") String newTaskNo);

    void deleteAllProcessHead(PcStyleCraftRequest rep);

    void deleteAllProcessDetail(PcStyleCraftRequest rep);

    void deleteDiff(PcStyleCraftRequest rep);

    void insertIntoSdProcess(@Param("request1") PcStyleCraftRequest request1, @Param("request2") PcStyleCraftRequest request2);

    BigDecimal getTaskSizeQtyTotal(TaskFilingDetailResp req);

    BigDecimal getTaskPlanQty(TaskFilingDetailResp req);

    List<StyleProductionProcess> getSeq(PcDiffPart diffPart);

    void updateSdProcess(PcDiffPart diffPart);

    Integer getDiffCount(@Param("req") StyleProductionProcess req, @Param("style") String style, @Param("styleColor") String styleColor);

    void updatePrintFlag(@Param("request") List<TrailTaskHead> request);

    Integer getMaxCode(String type);

    int getTaskSizeQtys(TaskFilingDetailResp req);

    List<String> getLs(@Param("type") String type, @Param("companyId") String companyId);

    String getTypeName(@Param("stk") String stk, @Param("companyId") String companyId, @Param("seqNo") int seqNo);

    String getprocess1(@Param("seqNo") String seqNo, @Param("processCode") String processCode, @Param("companyId") String companyId);

    List<PcCuttingProcessV> getPcProcess();

    void insertProcessNew1(@Param("list") List<StyleProductionProcess> list);

    Integer getDispatchByStyle(PcStyleCraftRequest request);

    String getFlagByProcessHead(@Param("style") String style, @Param("styleColor") String styleColor, @Param("companyId") String companyId);
}
